<template>
	<view class="content">
		<view class="title">
			<text class="title-txt">大家都在听...</text>
		</view>
		<view class="list">
			<view class="list-item" v-for="(item,index) in result" :key="item.id" @tap ="send(item.id)">
				<img :src="item.coverImgUrl" alt="">
				<u--text :text="item.name" lines="2" size="15rpx"></u--text>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		_getFeaturedDisc,
	} from '@/http/home.js';
	export default {
		name: "Category",
		data() {
			return {
				result: [],
				limit: 6
			}
		},
		methods: {

			async getFeaturedDisc() {
				const {
					playlists = []
				} = await _getFeaturedDisc(this.limit)
				this.result = playlists
			},

			//歌单详情
			send(id) {
				uni.navigateTo({
					url: '/view/SongSheet/SongSheet?id=' + id
				})
			},
		},
		created() {
			this.getFeaturedDisc()
		}
	}
</script>

<style lang="scss" scoped>
	.content {
		background-color: #fff;
	}

	.title {
		display: flex;
		justify-content: space-between;
		padding: 20rpx 30rpx;

		&-txt {
			flex: 10;
			font-size: 30rpx;
		}
	}

	.list {
		margin: 0rpx 30rpx;
		display: flex;
		flex-wrap: wrap;
		justify-content: space-between;


		&-item {
			display: flex;
			flex-direction: column;
			flex-wrap: wrap;
			align-items: center;
			width: 33%;
			margin: 15rpx 0rpx;


			img {
				width: 210rpx;
				height: 210rpx;
				border-radius: 20rpx;
				box-shadow: 0px -5px 0px 0px rgba(0, 0, 0, .1);
			}
		}
	}
</style>
